<template>
  <view class="segmented-control tn-mb-xl" style="margin-top: 80rpx">
    <view v-for="(tab, index) in tabs" :key="index" :class="['tab', { active: currentTab === index }]" @tap="changeTab(index)">
      {{ tab }}
    </view>
  </view>
</template>

<script setup lang="ts">
import { defineProps } from "vue";

const props = defineProps({
  tabs: Array,
  currentTab: Number,
  changeTab: Function
});
</script>

<style lang="scss" scoped>
	.segmented-control {
		position: relative;
		display: flex;
		background-color: #f0f0f0;
		border-radius: 30rpx;
		margin: 20rpx;
		padding: 5rpx;
		z-index: 1;
		/* 设置为中间层级 */
	}
	
	
.tab {
  flex: 1;
  text-align: center;
  padding: 15rpx 0;
  font-size: 28rpx;
  color: #999;
  border-radius: 25rpx;
  transition: all 0.3s ease;
  cursor: pointer;
}

.tab.active {
  background-color: #00aaff; /* 确保与原样式一致 */
  color: #ffffff;
  box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
</style>
